//<template>
    <div>
        <p>图片<input type="file" id="img"></p>
        <p>内容<input type="text" v-model="content"></p>
        <p><button @click="estimate">发表</button></p>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    data(){
        return{
            content:'',
            order_id:this.$route.params.id,
            user_id:sessionStorage.getItem('user_id')
        }
    },
    methods:{
        estimate(){
            let img = document.getElementById('img').fiels[0]
            let form_data = new FormData()
            form_data.append('order_content',this.content)
            form_data.append('order_img',img)
            form_data.append('order',this.order_id)
            form_data.append('user',this.user_id)
            axios({
                url:'http://127.0.0.1:8000/app02/estimate_add/',
                method:'post',
                data:form_data
            }).then(res=>{
                console.log(res.data)
            })
        }
    }
}
</script>

<style>

</style>